package a.f.l.a;

import a.c.d;
import a.d.w;
import a.f.ad;
import a.f.tb;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;

class cc
  extends sb
{
  private ArrayList f;
  private mb g;
  private cb h;
  private int i;
  
  protected void c()
  {
    super.c();
    this.f = null;
    this.g = null;
    this.h = null;
  }
  
  protected void a(qb paramqb)
  {
    super.a(paramqb);
    this.h = paramqb.c().m();
  }
  
  protected void b(rb paramrb)
  {
    boolean bool = sb.e;
    int k = sb.d;
    super.b(paramrb);
    this.i = paramrb.e().f().a();
    this.g = paramrb.i();
    d locald = paramrb.d();
    r localr = a().a(locald);
    List localList;
    if ((bool) || (localr != null))
    {
      localList = localr.c(false);
      if (bool) {
        break label85;
      }
      if (k == 0) {}
    }
    else
    {
      localList = null;
    }
    this.f = null;
    label85:
    if (localList != null)
    {
      int j = 0;
      Iterator localIterator = localList.iterator();
      ad localad;
      while (localIterator.hasNext())
      {
        localad = (ad)localIterator.next();
        if (!localad.b())
        {
          if ((bool) || ((!bool) && (k != 0))) {
            break label166;
          }
          if (localad.a() == 255) {
            j = 1;
          }
        }
      }
      if (j == 0)
      {
        this.f = new ArrayList(localList.size());
        localIterator = localList.iterator();
        do
        {
          if (!localIterator.hasNext()) {
            break;
          }
          localad = (ad)localIterator.next();
          this.f.add(new a_(localad, localr));
        } while (k == 0);
      }
    }
    label166:
  }
  
  double[] a(h paramh, mb parammb, jb[] paramArrayOfjb, m[] paramArrayOfm, double[] paramArrayOfDouble)
  {
    boolean bool = sb.e;
    if (!bool)
    {
      if (this.i == 0) {
        b("bend penalty", 0.0D, false);
      }
    }
    else {
      return new double[paramArrayOfjb.length];
    }
    tb localtb1 = paramh.d();
    if (!bool) {
      if (localtb1 == null)
      {
        b("bend penalty", 0.0D, false);
        return new double[paramArrayOfjb.length];
      }
    }
    tb localtb2 = paramArrayOfm[0].p();
    if (!bool) {
      if (localtb1 == localtb2) {
        return super.a(paramh, parammb, paramArrayOfjb, paramArrayOfm, paramArrayOfDouble);
      }
    }
    if (localtb1.c() == localtb2)
    {
      if (bool) {
        break label119;
      }
      d1 = 2.0D;
      if (sb.d == 0) {
        break label121;
      }
    }
    label119:
    double d1 = 1.0D;
    label121:
    double d2 = d1 * this.i;
    b("bend penalty", d2, false);
    double[] arrayOfDouble = new double[paramArrayOfjb.length];
    if (d2 > 0.0D) {
      Arrays.fill(arrayOfDouble, d2);
    }
    return arrayOfDouble;
  }
  
  protected double a(h paramh, mb parammb, jb paramjb, m paramm, double paramDouble)
  {
    if (paramm.e() == 1)
    {
      if (sb.e) {
        break label27;
      }
      d1 = 2.0D;
      if (sb.d == 0) {
        break label29;
      }
    }
    label27:
    double d1 = 0.0D;
    label29:
    double d2 = d1 * this.i;
    a("bend penalty", d2, false);
    return d2;
  }
  
  protected double b(h paramh)
  {
    boolean bool3 = sb.e;
    int k = sb.d;
    if (!bool3) {
      if (this.i != 0)
      {
        if (bool3) {
          break label59;
        }
        if (!b().d(paramh.a())) {
          break label51;
        }
      }
    }
    a("HEUR bend penalty", 0.0D, true);
    return 0.0D;
    label51:
    label59:
    boolean bool1 = a(paramh, this.g);
    boolean bool2 = b(paramh, this.g);
    int j;
    if (this.f != null)
    {
      if (!bool3) {}
      if (!bool3) {}
      j = bool2 ? 0 : bool1 ? 2 : 1;
      j = a(paramh, j);
      if (bool3) {
        break label255;
      }
      if (k == 0) {}
    }
    else
    {
      if (!bool3) {
        if (bool1)
        {
          if (!bool3) {}
          j = this.h == null ? 2 : c(paramh, this.g);
          if (bool3) {
            break label255;
          }
          if (k == 0) {
            break label235;
          }
        }
      }
      if (bool2)
      {
        if (!bool3) {}
        j = this.h == null ? 0 : e(paramh, this.g);
        if (bool3) {
          break label255;
        }
        if (k == 0) {}
      }
      else
      {
        if (!bool3) {}
        j = this.h == null ? 1 : g(paramh, this.g);
      }
    }
    label235:
    a("HEUR bend penalty", j * this.i, true);
    label255:
    return j * this.i;
  }
  
  private static boolean a(h paramh, mb parammb)
  {
    boolean bool = sb.e;
    tb localtb = paramh.d();
    mb localmb = paramh.a();
    if (!bool) {
      if (localtb == tb.b)
      {
        if (!bool) {}
        return parammb.k() <= localmb.i();
      }
    }
    if (!bool) {
      if (localtb == tb.d)
      {
        if (!bool) {}
        return localmb.k() <= parammb.i();
      }
    }
    if (localtb == tb.a)
    {
      if (!bool) {}
      return localmb.l() <= parammb.j();
    }
    if (!bool) {}
    return parammb.l() <= localmb.j();
  }
  
  private static boolean b(h paramh, mb parammb)
  {
    tb localtb = paramh.d();
    jb localjb;
    if (localtb.d())
    {
      localjb = parammb.a(mb.a_.d);
      if (sb.e) {
        break label51;
      }
      if (sb.d == 0) {}
    }
    else
    {
      localjb = parammb.a(mb.a_.a);
    }
    label51:
    return paramh.c().a(localjb, 0.1D);
  }
  
  private int c(h paramh, mb parammb)
  {
    boolean bool = sb.e;
    tb localtb = paramh.d();
    jb localjb1 = b(parammb, localtb);
    jb localjb2 = c(parammb, localtb);
    if (!bool) {
      if (!this.h.a(localjb1))
      {
        if (bool) {
          break label63;
        }
        if (this.h.a(localjb2)) {
          return 3;
        }
      }
    }
    label63:
    return 2;
  }
  
  private int e(h paramh, mb parammb)
  {
    boolean bool5 = sb.e;
    tb localtb = paramh.d();
    jb localjb1 = a(parammb, localtb);
    jb localjb2 = c(parammb, localtb);
    jb localjb3 = paramh.c();
    jb localjb4 = jb.a(localjb3, localjb1);
    jb localjb5 = new jb(localjb3.f(), localjb1.f(), 0.0D, !localjb3.a());
    if (!bool5) {
      if (this.h.a(localjb4)) {
        return 0;
      }
    }
    boolean bool1 = this.h.a(localjb1);
    boolean bool2 = this.h.a(localjb2);
    boolean bool3 = this.h.a(localjb3);
    boolean bool4 = this.h.a(localjb5);
    if (!bool5) {
      if (bool3)
      {
        if (!bool5) {
          if (!bool2)
          {
            if (bool5) {
              break label170;
            }
            if (bool1) {
              break label169;
            }
          }
        }
        return 1;
        label169:
        label170:
        return 2;
      }
    }
    if (!bool5) {
      if (localjb3.f(localjb1))
      {
        if (!bool5) {
          if (!bool1)
          {
            if (bool5) {
              break label217;
            }
            if (!bool2) {
              break label216;
            }
          }
        }
        if (!bool5) {
          if (!bool4) {
            label216:
            label217:
            return 0;
          }
        }
        if (!bool5) {
          if (!bool2) {
            return 2;
          }
        }
        return 3;
      }
    }
    if (!bool5) {
      if (bool2) {
        return 1;
      }
    }
    if (!bool5) {
      if (bool1)
      {
        if (bool5) {
          break label267;
        }
        if (bool4) {
          break label266;
        }
      }
    }
    return 0;
    label266:
    label267:
    return 2;
  }
  
  private int g(h paramh, mb parammb)
  {
    boolean bool = sb.e;
    tb localtb = paramh.d();
    jb localjb1 = b(parammb, localtb);
    jb localjb2 = c(parammb, localtb);
    jb localjb3 = paramh.c();
    jb localjb4 = new jb(localjb3.f(), (localtb == tb.b) || (localtb == tb.c) ? localjb2.c() : localjb2.b(), localjb2.f(), localjb2.a());
    if (!bool) {
      if (!this.h.a(localjb4))
      {
        if (bool) {
          break label120;
        }
        if (this.h.a(localjb1)) {
          return 2;
        }
      }
    }
    label120:
    return 1;
  }
  
  private jb a(mb parammb, tb paramtb)
  {
    boolean bool = sb.e;
    if (!bool) {
      if (paramtb == tb.b) {
        return parammb.a(mb.a_.d);
      }
    }
    if (!bool) {
      if (paramtb == tb.d) {
        return parammb.a(mb.a_.c);
      }
    }
    if (!bool) {
      if (paramtb == tb.c) {
        return parammb.a(mb.a_.a);
      }
    }
    if (paramtb == tb.a) {
      return parammb.a(mb.a_.b);
    }
    throw new IllegalArgumentException("Unknown direction: " + paramtb);
  }
  
  private jb b(mb parammb, tb paramtb)
  {
    boolean bool = sb.e;
    if (!bool) {
      if (paramtb == tb.b) {
        return parammb.a(mb.a_.c);
      }
    }
    if (!bool) {
      if (paramtb == tb.d) {
        return parammb.a(mb.a_.d);
      }
    }
    if (!bool) {
      if (paramtb == tb.c) {
        return parammb.a(mb.a_.b);
      }
    }
    if (paramtb == tb.a) {
      return parammb.a(mb.a_.a);
    }
    throw new IllegalArgumentException("Unknown direction: " + paramtb);
  }
  
  private jb c(mb parammb, tb paramtb)
  {
    boolean bool = sb.e;
    if ((bool) || (paramtb != tb.b))
    {
      if (bool) {
        break label38;
      }
      if (paramtb != tb.d) {}
    }
    else
    {
      return parammb.a(mb.a_.a);
    }
    label38:
    if ((bool) || ((paramtb == tb.c) || (paramtb == tb.a))) {
      return parammb.a(mb.a_.d);
    }
    throw new IllegalArgumentException("Unknown direction: " + paramtb);
  }
  
  private int a(h paramh, int paramInt)
  {
    boolean bool = sb.e;
    int m = sb.d;
    int j = 2147483647;
    if ((bool) || (this.f != null))
    {
      if (bool) {
        break label154;
      }
      if (!this.f.isEmpty())
      {
        Iterator localIterator = this.f.iterator();
        do
        {
          if (localIterator.hasNext())
          {
            a_ locala_ = (a_)localIterator.next();
            int k = 0;
            do
            {
              if (k >= locala_.a.length) {
                break;
              }
              j = Math.min(j, a(paramh, locala_.a[k], locala_.c[k]));
              if ((bool) || ((!bool) && (m != 0))) {
                break label152;
              }
            } while (m != 0);
            if (j <= paramInt) {
              return j;
            }
            k++;
            if (m == 0) {
              break;
            }
          }
        } while (bool);
        label152:
        return j;
      }
    }
    label154:
    return paramInt;
  }
  
  private int a(h paramh, jb paramjb, tb paramtb)
  {
    boolean bool2 = sb.e;
    jb localjb1 = paramh.c();
    tb localtb = paramh.d();
    if (!bool2) {
      if (localtb == paramtb)
      {
        boolean bool1 = a(localjb1.f(), paramjb.f(), localtb);
        if ((bool2) || (!bool1)) {
          return 4;
        }
        if (!bool2) {}
        if (!bool2) {
          if (localjb1.a(paramjb, paramjb.d() > 0.0D ? 0.1D : 0.0D))
          {
            if (!bool2) {
              if ((paramjb.d() > 0.0D) && ((bool2) || (this.h != null)))
              {
                if (bool2) {
                  break label174;
                }
                if (!this.h.a(jb.a(localjb1, paramjb)))
                {
                  if (!bool2) {
                    if (!this.h.a(localjb1))
                    {
                      if (bool2) {
                        break label174;
                      }
                      if (!this.h.a(paramjb)) {
                        break label173;
                      }
                    }
                  }
                  return 2;
                }
              }
            }
            label173:
            label174:
            return 0;
          }
        }
        return 2;
      }
    }
    if (localtb.c() == paramtb)
    {
      jb localjb2 = this.g.a(mb.a_.a(paramtb));
      if (!bool2) {
        if (a(localjb1.f(), localjb2.f(), localtb))
        {
          if (bool2) {
            break label240;
          }
          if (localjb1.f(localjb2)) {
            return 4;
          }
        }
      }
      label240:
      return 2;
    }
    if ((bool2) || (a(paramjb.f(), localjb1.b(), paramtb)))
    {
      if (bool2) {
        break label312;
      }
      if (a(paramjb.f(), localjb1.c(), paramtb)) {}
    }
    else
    {
      if ((!bool2) && (this.h == null)) {
        break label315;
      }
      if (bool2) {
        break label312;
      }
    }
    label312:
    label315:
    int j = a(localjb1, paramjb, paramtb) ? 1 : 0;
    if ((bool2) || (!a(localjb1.f(), paramjb.b(), localtb)))
    {
      if (bool2) {
        break label392;
      }
      if (!a(localjb1.f(), paramjb.c(), localtb)) {}
    }
    else
    {
      if ((!bool2) && (this.h == null)) {
        break label395;
      }
      if (bool2) {
        break label392;
      }
    }
    label392:
    label395:
    int k = b(localjb1, paramjb, localtb) ? 1 : 0;
    if (!bool2) {
      if (j == 0) {
        if (bool2) {
          break label419;
        }
      }
    }
    label419:
    return k != 0 ? 3 : 1;
  }
  
  private boolean a(jb paramjb1, jb paramjb2, tb paramtb)
  {
    boolean bool = sb.e;
    if ((bool) || (!paramjb1.e().a(paramjb2.f()))) {
      return false;
    }
    jb localjb1;
    jb localjb2;
    if ((bool) || ((paramtb == tb.b) || (paramtb == tb.c)))
    {
      localjb1 = new jb(paramjb1.b(), paramjb2.f(), 0.0D, paramjb1.a());
      localjb2 = new jb(paramjb1.c(), paramjb2.f(), 0.0D, paramjb1.a());
      if (bool) {
        break label153;
      }
      if (sb.d == 0) {}
    }
    else
    {
      localjb1 = new jb(paramjb1.c(), paramjb2.f(), 0.0D, paramjb1.a());
      localjb2 = new jb(paramjb1.b(), paramjb2.f(), 0.0D, paramjb1.a());
    }
    label153:
    if ((bool) || (!this.h.a(localjb1))) {
      if (bool) {}
    }
    return this.h.a(localjb2);
  }
  
  private boolean b(jb paramjb1, jb paramjb2, tb paramtb)
  {
    boolean bool = sb.e;
    if ((bool) || (!paramjb2.e().a(paramjb1.f()))) {
      return false;
    }
    jb localjb1;
    jb localjb2;
    if ((bool) || ((paramtb == tb.b) || (paramtb == tb.c)))
    {
      localjb1 = new jb(paramjb2.c(), paramjb1.f(), 0.0D, paramjb2.a());
      localjb2 = new jb(paramjb2.b(), paramjb1.f(), 0.0D, paramjb2.a());
      if (bool) {
        break label153;
      }
      if (sb.d == 0) {}
    }
    else
    {
      localjb1 = new jb(paramjb2.b(), paramjb1.f(), 0.0D, paramjb2.a());
      localjb2 = new jb(paramjb2.c(), paramjb1.f(), 0.0D, paramjb2.a());
    }
    label153:
    if ((bool) || (!this.h.a(localjb1))) {
      if (bool) {}
    }
    return this.h.a(localjb2);
  }
  
  private static boolean a(double paramDouble1, double paramDouble2, tb paramtb)
  {
    boolean bool = sb.e;
    if ((bool) || ((tb.b == paramtb) || (tb.c == paramtb)))
    {
      if (!bool) {}
      return paramDouble2 > paramDouble1;
    }
    if (!bool) {}
    return paramDouble2 < paramDouble1;
  }
  
  private static tb a(int paramInt)
  {
    switch (paramInt)
    {
    case 1: 
      return tb.c;
    case 2: 
      return tb.a;
    case 4: 
      return tb.d;
    case 8: 
      return tb.b;
    }
    return tb.c;
  }
  
  private class a_
  {
    final jb[] a;
    final tb[] c;
    
    a_(ad paramad, r paramr)
    {
      w localw = paramad.b() ? paramr.a(paramad, false) : null;
      if (!bool) {
        if (paramad.a() == 255)
        {
          this.a = new jb[4];
          this.c = new tb[4];
          this.a[0] = a(1, paramad.b(), localw);
          this.c[0] = tb.c;
          this.a[1] = a(2, paramad.b(), localw);
          this.c[1] = tb.a;
          this.a[2] = a(4, paramad.b(), localw);
          this.c[2] = tb.d;
          this.a[3] = a(8, paramad.b(), localw);
          this.c[3] = tb.b;
          if (!bool) {
            if (sb.d == 0) {
              return;
            }
          }
        }
        else
        {
          this.a = new jb[] { a(paramad.a(), paramad.b(), localw) };
        }
      }
      this.c = new tb[] { cc.a(paramad.e().b()) };
    }
    
    private jb a(int paramInt, boolean paramBoolean, w paramw)
    {
      boolean bool = sb.e;
      if (!bool) {
        if (paramBoolean)
        {
          if (!bool) {
            if (paramInt == 1) {
              return new jb(paramw.a(), paramw.a(), cc.this.g.j(), false);
            }
          }
          if (!bool) {
            if (paramInt == 2) {
              return new jb(paramw.a(), paramw.a(), cc.this.g.l(), false);
            }
          }
          if (!bool) {
            if (paramInt == 4) {
              return new jb(paramw.b(), paramw.b(), cc.this.g.k(), true);
            }
          }
          if (paramInt != 8) {
            break label250;
          }
          return new jb(paramw.b(), paramw.b(), cc.this.g.i(), true);
        }
      }
      if (!bool) {
        if (paramInt == 1) {
          return cc.this.g.a(mb.a_.a);
        }
      }
      if (!bool) {
        if (paramInt == 2) {
          return cc.this.g.a(mb.a_.b);
        }
      }
      if (!bool) {
        if (paramInt == 4) {
          return cc.this.g.a(mb.a_.c);
        }
      }
      if (paramInt == 8) {
        return cc.this.g.a(mb.a_.d);
      }
      label250:
      return null;
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.l.a.cc

 * JD-Core Version:    0.7.0.1

 */